//{
//  Module is a part of project http://code.google.com/p/drivers-training-request
//  Copyright (C) 2012 Leonid Vlasov leoniv@bk.ru
//
//  This source is free software; you can redistribute it and/or modify it under
//  the terms of the GNU General Public License as published by the Free
//  Software Foundation; either version 2 of the License, or (at your option)
//  any later version.
//
//  This code is distributed in the hope that it will be useful, but WITHOUT ANY
//  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
//  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
//  details.
//
//  A copy of the GNU General Public License is available on the World Wide Web
//  at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing
//  to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
//  MA 02111-1307, USA.
//}
//
{ TGridTemplate }
constructor TGridTemplate.Create(AFixedCols, AFixedRows: Integer;
  AOptions: TGridOptions);
begin
  FFixedCols:=AFixedCols;
  FFixedRows:=AFixedRows;
  FOptions:=AOptions;
end;

{ TTableOfObject }
//
//function TTableOfObject.GetCel(ColName: String; Row: integer): String;
//begin
//  Raise Exception.Create('Metod <TTableOfObject.GetCel> Not Emplemet Yet');
//  {TODO  -o: -c: : Реализовать метод TTableOfObject.GetCel }
//end;
//
//function TTableOfObject.GetColumn(Name: String): TFieldDescriptor;
//begin
//  Raise Exception.Create('Metod <TTableOfObject.GetColumn> Not Emplemet Yet');
//  {TODO  -o: -c: : Реализовать метод TTableOfObject.GetColumn }
//end;
//
//procedure TTableOfObject.SetCel(ColName: String; Row: integer; AValue: String);
//begin
//  Raise Exception.Create('Metod <TTableOfObject.SetCel> Not Emplemet Yet');
//  {TODO  -o: -c: : Реализовать метод TTableOfObject.SetCel }
//end;
//
//procedure TTableOfObject.SetGrid(GridTemplate: TGridTemplate; AGrid: TStringGrid
//  );
//var
//  Col:TGridColumn;
//  i: Integer;
//begin
//  if AValue=Nil then exit;
//  if GridTemplate<>nil then
//    begin
//      FGrid.Assign(AGrid);
//      FGrid.FixedRows:=1;//Всегда есть заголоавок
//      FGrid.FixedCols:=GridTemplate.FixedCols;
//      if Assigned(GridTemplate.OnKeyDown) then
//         FGrid.OnKeyPress:=GridTemplate.OnKeyDown;
//      FGrid.Options:=GridTemplate.Options;
//    end;
//   FGrid.RowCount:=FGrid.FixedRows;
//   if (FGrid.FixedRows > 0) and (goFixedRowNumbering in FGrid.Options) then
//         FGrid.ColWidths[0]:=FGrid.Font.Size*3;
//   FGrid.Columns.Clear;
//   for i:= 0 to Length(FColumns)-1 do
//   begin
//      Col:=FGrid.Columns.Add;
//      Col.Index:=i;
//      if FColumns[i].PicList.Count > 0 then
//         Col.PickList.Assign(FColumns[i].PicList);
//      Col.Alignment:=taLeftJustify;
//      Col.Width:= round(FGrid.Width*FColumns[i].Width/TotalColumnsWidth());
//      Col.Expanded:=True;
//      Col.Title.Caption:=FColumns[i].Caption;
//      Col.Title.Alignment:=taCenter;
//      Col.Title.Font.Style:=[fsBold];
//   end;
//   DataToGrid();
//end;
//
//function TTableOfObject.GetGrid(GridTemplate: TGridTemplate): TStringGrid;
//begin
//  Result:=FGrid;
//end;
//
//function TTableOfObject.TotalColumnsWidth: Integer;
//begin
//     Result:=0;
//    for i:=0 to Length(FColumns) do
//      Result:= Result+FColumns[i].Width;
//end;
//
//
//procedure TTableOfObject.DataToGrid;
//function GridRowIndex(I:Integer):Integer;
//begin
//  Resil:=I+FGrid.FixedRows;
//end;
//function GridColIndex(I:Integer):Integer;
//begin
//  Resil:=I+FGrid.FixedCols;
//end;
//begin
//  if FGrid = nil then exit;
//  FGrid.RowCount:=Length(FDataRows)+FGrid.FixedRows;
//  for i:=0 to Length(FDataRows)-1 do
//  begin
//       for j:=0 to Length(FColumns) do
//       begin
//         FGrid.Cells[GridColIndex(j),GridRowIndex(i)]:=FDataRows[i].Strings[j];
//       end;
//  end;
//end;
//
//procedure TTableOfObject.GridToData;
//begin
//   Raise Exception.Create('Metod <TTableOfObject.GridToData> Not Emplemet Yet');
//   {TODO  -o: -c: : Реализовать метод TTableOfObject.GridToData }
//end;
//
//function TTableOfObject.FixedCols: integer;
//begin
//  if FGrid<>nil;
//  Result:=FGrid.FixedCols;
//end;
//
//function TTableOfObject.FixedRows: Integer;
//begin
//  if FGrid<>nil;
//  Result:=FGrid.FixedRows;
//end;
//
//procedure TTableOfObject.Clear;
//begin
//  if FGrid <> nil
//     FGrid.Clean;
//end;
//
//{=================================================================================
//{ TTableDesc }
//
//procedure TTableDesc.SetGrid(AGrid: TStringGrid);
//Var
//  Col:TGridColumn;
//  i: Integer;
//  //j: Integer;
//begin
//  FGrid:=AGrid;
//  //FGrid.Clean(0,0,0,0,[gzFixedCols, gzFixedRows]);
//  FGrid.ColCount:=1;
//  FGrid.ColWidths[0]:=FGrid.Font.Size*3;
//  FGrid.RowCount:=2;
//  FGrid.FixedRows:=1;
//  FGrid.FixedCols:=1;
//  FGrid.OnKeyDown:=@KeyDown;
//  FGrid.Options:=[goAlwaysShowEditor,goColSizing,goDblClickAutoSize,goDrawFocusSelected,goEditing,goFixedHorzLine,goHorzLine,goFixedRowNumbering,goFixedVertLine,goFixedColSizing,goVertLine,goSmoothScroll];
//  //Колонки
//  FGrid.Columns.Clear;
//  for i:= 0 to Length(FFieldsDesc)-1 do
//  begin
//     Col:=FGrid.Columns.Add;
//     Col.Index:=i;
//     Col.PickList;
//     Col.Alignment:=taLeftJustify;
//     //Надо расчилать пропрционально
//     Col.Width:=FFieldsDesc[i]^.Width;
//     Col.Expanded:=True;
//     //for j:=0 to Length(FFieldsDesc[i]^.PiClist)-1 do
//     //begin
//     //  Col.PickList.Add(FFieldsDesc[i]^.PiClist[j]);
//     //end;
//     Col.Title.Caption:=FFieldsDesc[i]^.Caption;
//     Col.Title.Alignment:=taCenter;
//     Col.Title.Font.Style:=[fsBold];
//  end;
//
//end;
//
//procedure TTableDesc.KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
//  );
//begin
//  if Key = VK_INSERT then
//  begin
//   TStringGrid(Sender).RowCount:=TStringGrid(Sender).RowCount+1;
//   TStringGrid(Sender).Row:=TStringGrid(Sender).RowCount-1;
//   TStringGrid(Sender).Col:=TStringGrid(Sender).FixedCols;
//  end
//  else if (Key = VK_DELETE) and (Shift = [ssCtrl]) then
//  begin
//   if TStringGrid(Sender).Row = TStringGrid(Sender).FixedRows-1 then exit;
//   TStringGrid(Sender).DeleteRow(TStringGrid(Sender).Row);
//  end;
//end;
//
//constructor TTableDesc.Create(AFields: TFieldsDescRecords);
//var
//  i: Integer;
//begin
//     for i:=0 to Length(AFields)-1 do
//     begin
//       Add(AFields[i]);
//     end;
//end;
//
//constructor TTableDesc.Create;
//begin
//
//end;
//
//procedure TTableDesc.Add(FildDesc: PFieldDesc);
//begin
//   SetLength(FFieldsDesc,Length(FFieldsDesc)+1);
//   FFieldsDesc[Length(FFieldsDesc)-1]:=FildDesc;
//end;
//
//function TTableDesc.ValidCell(Col, Row: Integer; Mess: String): Boolean;
//begin
//
//end;
//====================================================================================}
//
//

